package com.wanshi.utils;

/**
 * @Created by IntelliJ IDEA.
 * @Author Journey
 * @Date 2021/12/10 9:43
 */
public class Result {

    private Integer code;

    private String msg;

    private Boolean flag;

    private Object data;



    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Boolean getFlag() {
        return flag;
    }

    public void setFlag(Boolean flag) {
        this.flag = flag;
    }

    public Result() {
    }

    public static Result ok(){
        return new Result(Constats.SUCCESS,"成功",Constats.TR);
    }

    public static Result error(){
        return new Result(Constats.ERROR,"失败",Constats.FA);
    }

    public static Result ok(Object obj){
        return new Result(Constats.SUCCESS,"成功",obj,Constats.TR);
    }

    public static Result error(String msg){
        return new Result(Constats.ERROR,msg,Constats.FA);
    }

    public  static Result nologin(){
        return new Result(Constats.NOLOGIN,"登陆过期",null);
    }
    public Result(Integer code, String msg, Object data,Boolean flag) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.flag = flag;
    }

    public Result(Integer code, String msg, Boolean flag) {
        this.code = code;
        this.msg = msg;
        this.flag = flag;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
